part of 'view.dart';

final class _FloodCardPaint extends CustomPainter {
  const _FloodCardPaint({
    this.bezierCenterX,
    this.radius = 17,
    this.cornerHeight = 32,
  });

  final double? bezierCenterX;
  final double radius;
  final double cornerHeight;

  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint()
      ..color = const Color(0xffF6F8FF)
      ..style = PaintingStyle.fill;

    final bezierCenterX = this.bezierCenterX ?? size.width / 2;
    final path = Path()
      ..moveTo(0, size.height)
      ..lineTo(size.width, size.height)
      ..lineTo(size.width, 0)
      ..lineTo(bezierCenterX + radius, 0)
      ..cubicTo(
        bezierCenterX - radius,
        0,
        bezierCenterX + radius,
        cornerHeight,
        bezierCenterX - radius,
        cornerHeight,
      )
      ..lineTo(radius, cornerHeight)
      ..arcToPoint(
        Offset(0, cornerHeight + radius),
        radius: Radius.circular(radius),
        clockwise: false,
      )
      ..lineTo(0, size.height);

    canvas.drawPath(path, paint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}
